﻿#region GNU General Public License
// XEdit2D - XNA 2D Asset Editor
// Copyright (C) 2010  HurlBat Games

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
#endregion

using System;
using System.Windows.Forms;

namespace HurlBat.XEdit2D
{
    public partial class BatchCreateAnimation : Form
    {
        public BatchCreateAnimation()
        {
            InitializeComponent();
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Hide();
        }

        private void BatchCreateAnimation_VisibleChanged(object sender, EventArgs e)
        {
            if (Visible)
            {
                numFrameWidth.Value = Globals.AppStore.FrameWidth;
                numFrameHeight.Value = Globals.AppStore.FrameHeight;
                numFramesPerRow.Value = Globals.AppStore.FramesPerRow;
                numFramesPerColumn.Value = Globals.AppStore.FramesPerColumn;
                numTotalFrames.Value = Globals.AppStore.TotalFrames;
                chkRemoveImages.Checked = Globals.AppStore.RemoveImages;
            }
            else
            {
                Globals.AppStore.FrameWidth = numFrameWidth.Value;
                Globals.AppStore.FrameHeight = numFrameHeight.Value;
                Globals.AppStore.FramesPerRow = numFramesPerRow.Value;
                Globals.AppStore.FramesPerColumn = numFramesPerColumn.Value;
                Globals.AppStore.TotalFrames = numTotalFrames.Value;
                Globals.AppStore.RemoveImages = chkRemoveImages.Checked;

                Globals.AppStore.Save();
            }
        }
    }
}
